<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="/../Thinkphp/Application/Home/View/User/jquery/jquery-3.0.0.js"></script>
        <script>
            $(function($){
                $("#submit").click(function(){
                    var url="<?php print U('admin/user/doregister');?>";
                    var data={};
                    data['name']=$("#username").val();
                    data['pass']=$("#pass").val();
                    var dataType="json";
                    $.post(
                        url,
                        data,
                        function(data){                                                                               
                            if(data.status===1){
                                location.href=data.url;
                            }
                        },
                        dataType  
                );
                  return false;
                });
                $("#username").blur(function(){                  
                var url="<?php print U('admin/user/Verification');?>";                 
                var data={};
                data['name']=$("#username").val();            
                var dataType="json";
                $.post(
                        url,
                        data,
                        function(data){                            
                            if(data.status===0){                               
                                 $("#text").text(data.info);
                                 $("#text").css({"font-size" : "12px","color" :"red"});
                            }
                             if(data.status===2){
                               $("#text").text(data.info);
                               $("#text").css({"font-size" : "12px","color" :"red"});
                            }
                            if(data.status===1){
                               $("#text").text(data.info);                              
                            }
                        },
                        dataType                                
                );
                return false;
            });
            });
        </script>
        <style>
            .p{
                display: inline-block;
                position: absolute;
                top:0px;
                left: 248px;
            }
        </style>
    </head>
    <body>
        <div>
            <form action="<?php print U('admin/user/doregister');?>" method="post">
                账号：<input type="text" name="name" id="username"/><br/>
                密码：<input type="password" name="pass" id="pass"/><br/>
                <p id='text' class='p'></p>
                <input type='submit' value='注册' id='submit'/>
            </form>
        </div>
    </body>
</html>
